package util;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;

public class LoadProperty {
    /**
     * 自动读取Properties文件
     * @param path 文件路径
     * @return     返回值
     */
    public static Properties loadProperty(String path){
        FileInputStream fis = null;
        Properties ppt =new Properties();
        try {
            fis= new FileInputStream(path);
            ppt.load(fis);
            return ppt;
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            if (fis != null) {
                try {
                    fis.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
        return null;
    }
}
